$(document).ready(function(){
	$('#export, #export-options').click(function( e ) {
		e.preventDefault();
		self.location = $(this).attr('href') + '?' + $("#form-filter").serialize();
	});

	// Add formatted for Date fields
	var dt = new Date();
	var date_elems = ['input[name="filter_order_date_to"]', 'input[name="filter_order_date_from"]'];
	formatDatePickers(date_elems, 'MM/DD/YYYY', (dt.getMonth() + 1) + '/' + dt.getDate() + '/' + dt.getFullYear() );
});

/**
 * Format Date Fields.
 * @author AngelaMisa 02/18/2015
 * @param elems, format, max_date
 * @return void
 */
function formatDatePickers( elems, format, max_date ) {
	for ( var i = 0; i <= elems.length; i++ ) {
		$(elems[i]).datetimepicker({
			format: format,
			maxDate: max_date
		});
	}
}